package cdc.rxjava2.demo;

import io.reactivex.Flowable;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;

public class MapOperator1 {
	/**
	 * 
	 * map 是把传递过来的结果末尾加上了签名，然后在传递给了订阅者.
	 * 
	 * map的作用就变换 Flowable 然后返回一个指定类型的 Flowable 对象。
	 * 
	 * 
	 * */
	public MapOperator1() {
		Flowable.just("map")
        .map(new Function<String, String>() {
            @Override
            public String apply(String s) throws Exception {
                return s + " -ittianyu";
            }
        })
        .subscribe(new Consumer<String>() {
            @Override
            public void accept(String s) throws Exception {
                System.out.println(s);
            }
        });
	}

}
